<?php
namespace Admin\Model;
use Common\Model\CommonModel;
class FenxiaoModel extends CommonModel{
	
	//自动验证
	protected $_validate = array(
			//array(验证字段,验证规则,错误提示,验证条件,附加规则,验证时间)
			array('name', 'require', '名称不能为空！', 1, 'regex', 3),
		
	);


	/**
	 * 后台有更新/编辑则删除缓存
	 * @param type $data
	 */
	public function _before_write() {
		parent::_before_write();
		$this->data_cache();
	}
	public function _after_insert() {
		parent::_after_insert();
		$this->data_cache();
	}
	//删除操作时删除缓存
	public function _after_delete() {
		parent::_after_delete();
		$this->data_cache();
	}
	public function data_cache(){

		$data=$this->where(array("status"=>1))->select();



		foreach ($data as $k=>$v){

			$result[$v[id]]=$v;

		}

		F("Fenxiao",$result);
	}

}